from django.db import models
from django.utils.datetime_safe import datetime

class Categoria(models.Model):
    nome = models.CharField(max_length=150)
    
    def __unicode__(self):
        return self.nome


class Page(models.Model):

    titulo = models.CharField(max_length=100)
    nome = models.CharField(max_length=100)
    conteudo = models.TextField()
    publicado = models.BooleanField()
    data = models.DateTimeField(default=datetime.now(), blank=True)
    pai = models.ForeignKey('Page', related_name='pagina_pai', blank=True, null=True)
    ordem = models.IntegerField(blank=True)
    categoria = models.ForeignKey('Categoria', related_name='page_categoria')

    def __unicode__(self):
        return self.titulo
    